NodeEvent = RegisterEvents{
    "OnClick",
    -- 鼠标操作
    "MousePressed",
    "MouseMoved",
    "MouseReleased",
    -- 触摸操作
    "TouchPressed",
    "TouchMoved",
    "TouchReleased",
    -- 鼠标按下或者手指触屏
    "Pressed",
    "Moved",
    "Released",

    "HoverIn",
    "HoverOut",
    "FocusIn",
    "FocusOut",
    "WidthChanged",
    "WidthDirty",
    "HeightChanged",
    "HeightDirty",
    "AddChild",
    "RemoveChild",
    "SetParent",
    "OnChildClicked",
    "OnDragMoved",
    "OnDragEnded",
    "TransformDirty",
    "SlideValueChanged",
    "SwitchChanged",
    "Show",
    "ProgressValueChanged",
    "SelectOption",
}

if Setting.positionTransform == "toMouse" then
    NodeEvent.Pressed = NodeEvent.MousePressed
    NodeEvent.Released = NodeEvent.MouseReleased
    NodeEvent.Moved = NodeEvent.MouseMoved
end
Node = {}
function Node.new()
	return Entity.new():addComponent(Styled):addComponent(Transform)
end

Node.Root = Node.new()
local w, h = love.graphics.getDimensions()
Node.Root:wh(love.graphics.getDimensions())
Node.Root.x, Node.Root.y = w / 2, h / 2
EventDispatcher.global:on(GlobalEvent.WindowResized, Node.Root.wh, Node.Root)
EventDispatcher.global:on(GlobalEvent.WindowResized, function (width, height)
    Node.Root.x, Node.Root.y = width / 2, height / 2
end)